From f0d03727f69a84daff484ea9a7944d9c29daa5c3 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Thu, 24 Oct 2024 15:02:04 +0700
Subject: done page category brand

---
 src/pages/shop/find/[slug].jsx | 51 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)
 create mode 100644 src/pages/shop/find/[slug].jsx

(limited to 'src/pages/shop/find/[slug].jsx')

diff --git a/src/pages/shop/find/[slug].jsx b/src/pages/shop/find/[slug].jsx
new file mode 100644
index 00000000..4666add5
--- /dev/null
+++ b/src/pages/shop/find/[slug].jsx
@@ -0,0 +1,51 @@
+import axios from 'axios';
+import { useRouter } from 'next/router';
+import { useEffect, useState } from 'react';
+import Seo from '@/core/components/Seo';
+import dynamic from 'next/dynamic';
+
+const BasicLayout = dynamic(() =>
+  import('@/core/components/layouts/BasicLayout')
+);
+const ProductSearch = dynamic(() =>
+  import('@/lib/product/components/ProductSearch')
+);
+
+const BASE_URL = 'https://indoteknik.com';
+export default function FindPage() {
+  const route = useRouter();
+  const url = BASE_URL + route.asPath;
+  const [result, setResult] = useState(null);
+  const [query, setQuery] = useState(null);
+
+  const getUrls = async (url) => {
+    try {
+      let response = await axios(
+        `${process.env.NEXT_PUBLIC_SELF_HOST}/api/shop/url-category_brand?url=${url}`
+      );
+      let result = response?.data?.response?.docs[0] || null;
+      setResult(result);
+    } catch (error) {
+      console.error('Error fetching data:', error);
+    }
+  };
+
+  useEffect(() => {
+    getUrls(url);
+  }, []);
+
+  useEffect(() => {
+    if (result) {
+      let fq = `category_parent_ids:${result.category_id_i} AND manufacture_id_i:${result.brand_id_i}`;
+      setQuery({
+        fq : fq
+      });
+    }
+  }, [result]);
+
+  return (
+    <BasicLayout>
+      {query && <ProductSearch query={query} prefixUrl={`${route.asPath}`} />}
+    </BasicLayout>
+  );
+}
-- 
cgit v1.2.3


From 2657955cb4dc4cbe703d77bb43a6394a8ee98f74 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Thu, 24 Oct 2024 16:27:54 +0700
Subject: add seo

---
 src/pages/shop/find/[slug].jsx | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

(limited to 'src/pages/shop/find/[slug].jsx')

diff --git a/src/pages/shop/find/[slug].jsx b/src/pages/shop/find/[slug].jsx
index 4666add5..50797153 100644
--- a/src/pages/shop/find/[slug].jsx
+++ b/src/pages/shop/find/[slug].jsx
@@ -3,6 +3,8 @@ import { useRouter } from 'next/router';
 import { useEffect, useState } from 'react';
 import Seo from '@/core/components/Seo';
 import dynamic from 'next/dynamic';
+import { get } from 'lodash-contrib';
+import { getIdFromSlug, getNameFromSlug } from '@/core/utils/slug';
 
 const BasicLayout = dynamic(() =>
   import('@/core/components/layouts/BasicLayout')
@@ -18,6 +20,7 @@ export default function FindPage() {
   const [result, setResult] = useState(null);
   const [query, setQuery] = useState(null);
 
+  const slug = getNameFromSlug( route.query.slug) +' '+ getIdFromSlug( route.query.slug)
   const getUrls = async (url) => {
     try {
       let response = await axios(
@@ -38,13 +41,24 @@ export default function FindPage() {
     if (result) {
       let fq = `category_parent_ids:${result.category_id_i} AND manufacture_id_i:${result.brand_id_i}`;
       setQuery({
-        fq : fq
+        fq: fq,
       });
     }
   }, [result]);
 
   return (
     <BasicLayout>
+      <Seo
+        title={`Jual ${slug} di Indoteknik`}
+        description={`Jual ${slug} Kirim Jakarta Surabaya Semarang Makassar Manado Denpasar Balikpapan Medan Palembang Lampung Bali Bandung Makassar Manado.`}
+        additionalMetaTags={[
+          {
+            property: 'keywords',
+            content: `Jual ${slug}, harga ${slug}, ${slug} murah, toko ${slug}, ${slug} jakarta, ${slug} surabaya`,
+
+          },
+        ]}
+      />
       {query && <ProductSearch query={query} prefixUrl={`${route.asPath}`} />}
     </BasicLayout>
   );
-- 
cgit v1.2.3


From bb2fc00e1f399be919d7b777dd0ae17edd6b2a2e Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Fri, 25 Oct 2024 10:04:34 +0700
Subject: sitemap categories brand

---
 src/pages/shop/find/[slug].jsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'src/pages/shop/find/[slug].jsx')

diff --git a/src/pages/shop/find/[slug].jsx b/src/pages/shop/find/[slug].jsx
index 50797153..85e780ff 100644
--- a/src/pages/shop/find/[slug].jsx
+++ b/src/pages/shop/find/[slug].jsx
@@ -16,11 +16,12 @@ const ProductSearch = dynamic(() =>
 const BASE_URL = 'https://indoteknik.com';
 export default function FindPage() {
   const route = useRouter();
+  const qSlug = route?.query?.slug || null;
   const url = BASE_URL + route.asPath;
   const [result, setResult] = useState(null);
   const [query, setQuery] = useState(null);
 
-  const slug = getNameFromSlug( route.query.slug) +' '+ getIdFromSlug( route.query.slug)
+  const slug = qSlug ? getNameFromSlug(route?.query?.slug) +' '+ getIdFromSlug(route?.query?.slug) : '';
   const getUrls = async (url) => {
     try {
       let response = await axios(
-- 
cgit v1.2.3


From 16e46197ee2c9879ae8ef9a68d4ce67ae68843e3 Mon Sep 17 00:00:00 2001
From: trisusilo48 <tri.susilo@altama.co.id>
Date: Fri, 25 Oct 2024 10:24:24 +0700
Subject: seo title

---
 src/pages/shop/find/[slug].jsx | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'src/pages/shop/find/[slug].jsx')

diff --git a/src/pages/shop/find/[slug].jsx b/src/pages/shop/find/[slug].jsx
index 85e780ff..e7b8bd48 100644
--- a/src/pages/shop/find/[slug].jsx
+++ b/src/pages/shop/find/[slug].jsx
@@ -50,7 +50,7 @@ export default function FindPage() {
   return (
     <BasicLayout>
       <Seo
-        title={`Jual ${slug} di Indoteknik`}
+        title={`Jual ${slug} original - indoteknik.com`}
         description={`Jual ${slug} Kirim Jakarta Surabaya Semarang Makassar Manado Denpasar Balikpapan Medan Palembang Lampung Bali Bandung Makassar Manado.`}
         additionalMetaTags={[
           {
-- 
cgit v1.2.3

